using System;
using Voodoo.Sauce.Internal.GDPR;

namespace Voodoo.Sauce.Internal.Analytics.Trackers
{
	public static class VoodooTrackersAPI
	{
		private const string TAG = "VoodooTrackersAPI";

		private const string BaseUrl = "https://trackers.voodoo-analytics.io/";

		private const string Token = "070bd5ad-de8f-4a5d-8549-53499e4090e4";

		private const string DataSource = "&data_source=070bd5ad-de8f-4a5d-8549-53499e4090e4";

		private const string TokenCrossPromo = "271b91ba-35a4-4ecf-ac6f-f3f570642272";

		private const string DataSourceCrossPromo = "&data_source=271b91ba-35a4-4ecf-ac6f-f3f570642272";

		public static void Track(TrackersParams data, Action onSuccess, Action onError, bool crosspromo = false)
		{
			string url = "https://trackers.voodoo-analytics.io/" + data + (crosspromo ? "&data_source=271b91ba-35a4-4ecf-ac6f-f3f570642272" : "&data_source=070bd5ad-de8f-4a5d-8549-53499e4090e4");
			Requests.Get(url, null, delegate
			{
				VoodooLog.Log("VoodooTrackersAPI", "Successfully tracked: " + url);
				if (onSuccess != null)
				{
					onSuccess();
				}
			}, delegate
			{
				VoodooLog.Log("VoodooTrackersAPI", "Error while tracking: " + url);
				if (onError != null)
				{
					onError();
				}
			});
		}
	}
}
